#!/usr/bin/env bash
set -euo pipefail

# Usage examples:
#   bash scripts/train_yolov8.sh mps yolov8n.pt 640 20 16
#   bash scripts/train_yolov8.sh cuda yolov8s.pt 640 60 32

DEVICE=${1:-mps}               # mps | cuda | cpu
WEIGHTS=${2:-weights/yolov8n.pt}
IMGSZ=${3:-640}
EPOCHS=${4:-20}
BATCH=${5:-16}

echo "Training on device=$DEVICE weights=$WEIGHTS imgsz=$IMGSZ epochs=$EPOCHS batch=$BATCH"

yolo detect train \
  model="$WEIGHTS" \
  data=datasets/yolo/zny.yaml \
  imgsz="$IMGSZ" \
  epochs="$EPOCHS" \
  batch="$BATCH" \
  device="$DEVICE"

